<@override name="title">
    <#if oper=="create">
    新建游戏
    <#else>
    编辑游戏
    </#if>
</@override>

<@override name="viewbody">
<div class="row">
    <div class="col-md-12">
        <h3 class="page-title">
            游戏管理
            <small>
                <#if oper=="create">
                    创建新的游戏
                <#else>
                    修改已有游戏
                </#if>
            </small>
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="fa fa-home"></i>
                <a href="${ctx}/admin/home">
                    首页
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="${ctx}/admin/game/game">
                    游戏列表
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="#">
                    <#if oper=="create">
                        新建游戏
                    <#else>
                        编辑游戏
                    </#if>
                </a>
            </li>
        </ul>
    </div>
</div>

<form class="form-horizontal" action="${ctx}/admin/game/game/save" role="form" id="dataForm" method="post">
    <div class="panel panel-default">
        <div class="panel-heading"><h6 class="panel-title">游戏信息</h6></div>
        <div class="panel-body">
            <input name="game.id" type="hidden" value="${game.id!}"/>

            <div class="form-group">
                <label class="col-sm-2 control-label" for="game.category">游戏分类: <span class="mandatory">*</span></label>
                <div class="col-sm-9">
                    <select data-placeholder="选择游戏分类" name="game.category" id="game.category"
                            class="required form-control input-xlarge select2me">
                        <option value=""></option>
                        <#if categories??>
                            <#list categories as item>
                                <option value="${item.id}"
                                        <#if game.category?? && game.category == item.id>selected="selected"</#if> >${item.name}</option>
                            </#list>
                        </#if>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label" for="game.name">游戏名称: <span class="mandatory">*</span></label>
                <div class="col-sm-9">
                    <input type="text" class="form-control" name="game.name" id="game.name" value="${game.name!}">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label" for="gameAwards">游戏奖项: <span class="mandatory">*</span></label>
                <div class="col-sm-9">
                    <#--<select data-placeholder="选择游戏奖项" name="bankSel" id="bankSel"
                            class="required form-control input-xlarge select2me" multiple="" tabindex="-1">
                        <option value=""></option>
                        <#if brandList??>
                            <#list brandList as item>
                                <option value="${item.id},${item.name}" <#if activity.brand_names?? && activity.brand_names?contains(item.name)>selected="selected" </#if>>${item.name}</option>
                            </#list>
                        </#if>
                    </select>-->
                    <select data-placeholder="" name="gameAwards" id="gameAwards"
                            class="required form-control input-xlarge select2me" multiple="" tabindex="-1">
                        <option value=""></option>
                        <#if awardses??>
                            <#list awardses as item>
                                <#--<option value="${item.id}" <#if game.awards?? && game.awards == item.id>selected="selected"</#if> >${item.name}</option>-->
                                <option value="${item.id}" <#if item.selected?? && item.selected == "1">selected="selected"</#if> >${item.name}</option>
                            </#list>
                        </#if>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label" for="game.game_rule">游戏规则: <span class="mandatory">*</span></label>
                <div class="col-sm-9">
                    <select data-placeholder="选择游戏规则" name="game.game_rule" id="game.game_rule"
                            class="required form-control input-xlarge select2me">
                        <option value=""></option>
                        <#if rules??>
                            <#list rules as item>
                                <option value="${item.id}"
                                        <#if game.game_rule?? && game.game_rule == item.id>selected="selected"</#if> >${item.winning}/${item.total}</option>
                            </#list>
                        </#if>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label" for="game.remark">玩法介绍: <span class="mandatory">*</span></label>
                <div class="col-sm-9">
                    <textarea class="required form-control" rows="3" name="game.remark" id="game.remark">${game.remark!}</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label" for="game.summary">游戏概述: </label>
                <div class="col-sm-9">
                    <textarea class="form-control" rows="3" name="game.summary" id="game.summary">${game.summary!}</textarea>
                </div>
            </div>

            <#--<div class="form-group">

                <label class="col-sm-2 control-label" for="picture"></label>

                <div class="col-lg-2 col-md-4 col-sm-4">
                    <p class="form-control-static">
                        <input id="gameAttachmentUpload" type="file" class="btn">
                    </p>
                </div>
                <input type="hidden" id="picture" name="game.picture" value="${game.picture!}">
            </div>-->

            <div class="form-group">
                <label class="col-md-2 control-label">游戏海报：</label>

                <div class="col-md-9 single_pic">
                    <input type="hidden" id="picture" name="game.picture" value="${game.picture!}">
                    <input id="gameAttachmentUpload" type="file" class="btn">

                    <div class="picture" id="show_picture" style="display: ${(game.picture??)?string('display','none')};">
                        <a href="<#if game.picture??>${ctx}/${game.picture}</#if>"
                           class="thumbnail fancybox-button" id="box_picture" data-rel="logo">
                            <img src="<#if game.picture??>${ctx}/${game.picture?replace('.','.thumbnail.')}</#if>"
                                 alt=""/>
                        </a>
                        <a href="#" class="action" data-hook="remove_picture" data-target="#picture"
                           data-data="${game.picture!}"><i class="fa fa-times"></i> </a>
                    </div>
                </div>
            </div>
            <#--<div class="form-group" id="show_picture"
                 style="display: ${(game.picture??)?string('display','none')};">
                <label class="col-sm-2 control-label text-right">游戏海报:</label>

                <div class="col-lg-2 col-md-4 col-sm-4">
                    <a href="<#if game.picture??>${ctx}/${game.picture}</#if>" title="点击显示大图"
                       class="thumbnail fancybox-button" id="box_picture" data-rel="fancybox-button">
                        <img src="<#if game.picture??>${ctx}/${game.picture?replace('.','.thumbnail.')}</#if>"
                             alt=""/>
                    </a>
                </div>
            </div>-->
        </div>

        <div class="form-actions text-right">
            <a class="btn default yellow-stripe" href="${ctx}/admin/game/game">返回</a>
            <input type="submit" value="保存" class="btn btn-primary">
        </div>
    </div>
    </div>
</form>
</@override>

<@override name="viewmodule">game_item</@override>

<@extends name="../../_basic/main.ftl"></@extends>
